<template>
  <div class='content'>
    <div class="top">
      <el-select v-model="inventoryType" placeholder="商家类型">
          <el-option label="全部" value="eee"></el-option>
        <el-option label="平台直营" value="live"></el-option>
        <el-option label="商家寄存" value="food"></el-option>
      </el-select>
    </div>

    <div class="tables">
      <el-table :data="tableData" stripe style="width: 100%">
        <!-- 设置表头数据源，并循环渲染出来，property对应列内容的字段名 -->
        <el-table-column v-for="info in rightHeader" :key="info.key" :property="info.key" :label="info.label"
          align="center">
          <template slot-scope="scope">
             <!-- 渲染对应表格里面的内容 -->
             <span v-if="info.key!='apply'">{{scope.row[scope.column.property]}}</span>
             <span v-else class="link" @click="details(scope.row)">{{scope.row[scope.column.property]}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="set" label="操作" width="200" fixed="right" align="center">
          <template slot-scope="scope">
            <el-button type="primary" size="small">确认配货</el-button>
            <el-button type="danger" size="small" @click="dialogVisible=true">配货驳回</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="pages">
      <el-pagination background layout="prev, pager, next" :page-size="10" :total="100"
        @current-change="handleCurrentChange">
      </el-pagination>
    </div>

   <el-dialog
    title="配货驳回"
    :visible.sync="dialogVisible"
    width="30%"
    :before-close="handleClose">
    <div>
      <div style="margin-bottom:20px">驳回备注</div>
      <el-input
        type="textarea"
       :rows="4"
        placeholder="请输入内容"
        v-model="textarea2">
      </el-input>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="danger" @click="dialogVisible = false">确 定</el-button>
    </span>
  </el-dialog>
  </div>
</template>

<script>
  export default {
    //import引入的组件需要注入到对象中才能使用
    components: {},
    data() {
      //这里存放数据
      return {
        dialogVisible:false,
        inventoryType: null,
        textarea2:null,
        rightHeader: [{
            label: '编号',
            key: 'id'
          },
          {
            label: '申请人',
            key: 'menber'
          },
          {
            label: '申请时间',
            key: 'date'
          },
          {
            label: '商家类型',
            key: 'type'
          },
          {
            label: '商家名称',
            key: 'shopName'
          },
          {
            label: '配货申请',
            key: 'apply'
          }

        ],
        tableData: [{
          id: 'abc123',
          menber: '张三',
          date: '2019-12-28 12:00:00',
          type: '平台直营',
          shopName: '兰州拉面',
          apply:'套餐1*10、套餐2*50',
        },]
      };
    },
    //监听属性 类似于data概念
    computed: {},
    //监控data中的数据变化
    watch: {},
    //方法集合
    methods: {
      //确认或修改
      btnState(e){console.log(e)},
       //翻页
      handleCurrentChange(e) {
        console.log(e)
      },  
      // 跳转详情
      details(val){
        this.$router.push({path:'waitingDelivery/details'})
      }
    },
    //生命周期 - 创建完成（可以访问当前this实例）
    created() {

    },
    //生命周期 - 挂载完成（可以访问DOM元素）
    mounted() {

    },
    beforeCreate() {}, //生命周期 - 创建之前
    beforeMount() {}, //生命周期 - 挂载之前
    beforeUpdate() {}, //生命周期 - 更新之前
    updated() {}, //生命周期 - 更新之后
    beforeDestroy() {}, //生命周期 - 销毁之前
    destroyed() {}, //生命周期 - 销毁完成
    activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
  }

</script>
<style lang='scss' scoped>
  @import '~@/styles/chow.scss';
    .link{
        color:#409EFF;
        text-decoration: underline;
        cursor: pointer;
    }
</style>
